grep 0 /sys/kernel/debug/usb/ci_hdrc.0/device | grep speed
if [ $? -eq 1 ]
then
echo "没有插U盘"
exit 0
fi
echo host > /sys/kernel/debug/usb/ci_hdrc.0/role
sleep 5
lz=`blkid |grep sda1`
if [ $? -eq 0 ]
then
if [ ${lz##*=} != 'ntfs' ]
then
echo "是NTFS文件格式" 
mount -t ntfs-3g /dev/sda1 /lz
fi
mount  /dev/sda1 /lz
fi
df -h |grep sda1 > /dev/null 2>&1
if [ $? -eq 1 ]
then
echo "挂不上"
exit 0
else
echo "挂上了"
fi
ping qq.com -c 4 > /dev/null 2>&1
if [ $? -ep 2 ]
then
echo "没有连网"
exit 0 
fi
#更新源
apt-get update
apt-get upgrade -y
#安装npm redis 
apt install npm redis redis-server curl -y
npm -v
#安装nodesource库
curl -sL https://deb.nodesource.com/setup_16.x | bash - 
#安装nodejs
apt install nodejs -y

#安装中文字体
apt-get install ttf-mscorefonts-installer -y
apt-get install fontconfig -y
apt-get install ttf-wqy-zenhei -y
mkfontscale
mkfontdir
fc-cache -fv
fc-list

#安装Chrome依赖
apt-get install ca-certificates fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgbm1 libgcc1 libglib2.0-0 libgtk-3-0 libnspr4 libnss3 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 lsb-release wget xdg-utils -y
apt install chromium -y

#安装Chrome-browser
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-chromedriver_112.0.5615.49-0ubuntu0.18.04.1_arm64.deb
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-browser_112.0.5615.49-0ubuntu0.18.04.1_arm64.deb
wget http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_112.0.5615.49-0ubuntu0.18.04.1_arm64.deb
dpkg -i http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-chromedriver_112.0.5615.49-0ubuntu0.18.04.1_arm64.deb
dpkg -i http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-browser_112.0.5615.49-0ubuntu0.18.04.1_arm64.deb
dpkg -i http://ports.ubuntu.com/pool/universe/c/chromium-browser/chromium-codecs-ffmpeg-extra_112.0.5615.49-0ubuntu0.18.04.1_arm64.deb
apt-get update
apt-get upgrade -y
apt-get -f install

#克隆机器人
apt install git -y
git clone --depth=1 -b main https://gitee.com/Le-niao/Yunzai-Bot.git
cd Yunzai-Bot
npm --registry=https://registry.npmmirror.com install 
pnpm config set registry https://registry.npmmirror.com
pnpm install -P
#启动redis，启动云崽并登录
redis-server --save 900 1 --save 300 10 --daemonize yes 
 #后台启动
npm start 
